<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <style media="screen">
    *{
      padding:0px;
      margin:0px;
    }
    body{
      height:2000px;
    }
    nav{
      width:500px;
      height:60px;
      background:orange;
      margin:0 auto;
      position:relative;
    }
    .click{
      width:50px;
      height:50px;
      background:white;
      position:absolute;
      right: 5px;
      top:5px;
      cursor:pointer;
    }
    .list{
      width:200px;
      height: 300px;
      background:rgba(0,0,0,0.8);
      list-style: none;
      position: absolute;
      right: -200px;
      top:60px;
      opacity: 0;
    }
    .list li{
      margin-bottom:15px;
      font-size:30px;
      text-align: center;
      color:white;
    }
    .scroll{
      width:50px;
      height:50px;
      background:black;
      position: fixed;
      right:15px;
      bottom:15px;
      color:white;
      font-size:12px;
      line-height: 50px;
      cursor:pointer;
      opacity: 0;
    }
  </style>
  <title>Document</title>
</head>
<body>
  <nav>
    <div class="click">点击</div>
    <ul class="list">
      <li>Home</li>
      <li>About</li>
      <li>News</li>
      <li>Partners</li>
    </ul>
  </nav>
  <div class="scroll">回到顶部</div>
  <script type="text/javascript" src="jquery-1.11.0.js"></script>
  <script>
  var onOff = true;
    $(".click").click(function (){
      if(onOff){
        $('.list').animate({
          'right': 0,
          'opacity' : 1
        },500);
        onOff = false;
      }else{
        $('.list').animate({
          'right': -200,
          'opacity' : 0
        },500);
      onOff = true;
      }
    });
    $(window).scroll(function (){
      var top = $(window).scrollTop();
      if(top > 500){
        $('.scroll').css('opacity',1);
      }else{
        $('.scroll').css('opacity',0);
      }
    })
    $('.scroll').click(function (){
      $('html,body').animate({
        scrollTop : 0
      },500)
    })
  </script>
</body>
</html>
